<!--#include file="conn.asp"-->
<!--#include file="chkuser.asp"-->
<%
call adminRight(8)

if request("action")="add" then

	for i=0 to 9
		b=request(i)
		if b="" then b=0
		if a="" then
			a=b
		else
			a=a&"|"&b
		end if
	next
	a=replace(a," ","")

	user=trim(request("user"))
	pwd=trim(request("pwd"))

	Set rsc=server.CreateObject("ADODB.RECORDSET")
	sqlc="select * from Admin_lt_jt_wjk where admin_User_wjk='"&user&"' "
	rsc.open sqlc,conn,1,3
		if not rsc.eof then
			alert(user&"该用户名已存在！")	
			GoBack()
			response.End()
		end if
	rsc.close
	set rsc=nothing
	
	Set rs=server.CreateObject("ADODB.RECORDSET")
	sql="select * from Admin_lt_jt_wjk"
	rs.open sql,conn,2,3
	rs.addnew
	rs("admin_User_wjk")=user
	rs("admin_Pwd_wjk")=md5(pwd)
	rs("admin_right")=a
	rs.update
	rs.close
	set rs=nothing
	alert("添加成功!")
	Go("Admin_User.asp?showMsgStr=<br><b>"&user&"管理员已添加成功！</b>|parent|3000|500||")
	response.end

end if
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>添加管理员</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
   <form method="post" action="?action=add" onSubmit="return Juge(this)">
    <div id="frame_Toolbar" class="toolbarBg"> 
		<a href="javascript:self.history.back();" class="icoBtn_ct"><span class="btnIco btnBack"></span>返回</a> 
		<a href="javascript:self.location.reload();" class="icoBtn_ct"><span class="btnIco btnReload"></span>刷新</a> 
		<span class="split ftSplit" ></span>
	<div id="guide" class="light_orange">请填写动态信息！</div>
	<div class="pageInfo right light_gray"></div>
    </div>
    <table class="cTable_2 table">
	<tr class="cTitle toolbarBg">
		<td width="25%"><div class="cLeftPadding">添加管理员</div></td>
		<td width="75%"></td>
	</tr>
	<tr>
		<td class="tRight">用户名：</td>
		<td><input name="user" type="text" id="user" style="width:250px;" maxlength="100" />
	    <span id="RequiredFieldValidator1" style="color:Red;">*</span></td>
	</tr>
	<tr>
    <td class="tRight">密码：</td>
	  <td><input name="pwd" type="password" id="pwd" style="width:250px;" maxlength="100" />
        <span style="color:Red;"> *</span>&nbsp;&nbsp;</td>
	  </tr>
	<tr>
	  <td class="tRight">确认密码：</td>
	  <td><input name="pwd2" type="password" id="pwd2" style="width:250px;" maxlength="100" />
      <span style="color:Red;">*</span>&nbsp;</td>
	  </tr>
	<tr>
    <td class="tRight" valign="top" style="padding-top: 5px;">权限：</td>
	  <td>
	  <input name="0" type="checkbox" value="1" <%if fla0=1 then%>checked<%end if%>>
	    页面信息管理<br />
      <input name="1" type="checkbox" value="1" <%if fla1=1 then%>checked<%end if%>>
	    产品管理<br />
      <input name="2" type="checkbox" value="1" <%if fla2=1 then%>checked<%end if%>>
	    新闻管理<br />
      <input name="4" type="checkbox" value="1" <%if fla4=1 then%>checked<%end if%>>
	    招聘管理<br />

      <input name="6" type="checkbox" value="1" <%if fla6=1 then%>checked<%end if%>>
	    预订管理<br />
      <input name="8" type="checkbox" value="1" <%if fla8=1 then%>checked<%end if%>>
	    用户管理<br />
      <input name="9" type="checkbox" value="1" <%if fla9=1 then%>checked<%end if%>>
	    系统管理<br />
		 </td>
	  </tr>
    </table>
    <div id="cEndToolbar" class="toolbarBg">
      <div class="caButCase">
		    <input type="submit" name="Submit" value="确认添加" class="button">
	        <input type="reset" name="Submit2" value="清空重填" class="button">
      </div>
    </div>
  </form>
</body>
</html>
<script language="javascript">
function Juge(theForm)
{
    if(theForm.user.value==""){  
		alert("请填写用户名!");  
		theForm.user.focus();  
		return (false);  
	}
    if(theForm.pwd.value==""){  
		alert("请填写密码!");  
		theForm.pwd.focus();  
		return (false);  
	}  
    if(theForm.pwd2.value==""){  
		alert("请填写确认密码!");  
		theForm.pwd.focus();  
		return (false);  
	}  
    if(theForm.pwd.value!=theForm.pwd2.value){  
		alert("两次密码不一致，请重新输入!");  
		theForm.pwd.focus();  
		return (false);  
	}  
}
</script>